﻿<h2>
<?php /* This is translation of static text, Smart Framework automatically loads these translations  from translation files: */ ?>
<?= $this->translate("Category") ?>: 

<?php /* This is dynamic translation. Every category has it's name and it is stored in databse. SF takes care of fetching correct translation: */ ?>
<?= $this->category->translate("name") ?>
</h2>

<?php
	require_once('Zend/Currency.php');
	/* Cooperation between Zend Framework's Currency component and Smart Framework's multilingual system: */
	$currency = new Zend_Currency($this->lang->getZendId());
?>
<ul id="catalog"> 
	<?php /* Variable $this->products acts as an array, in fact it is Smart Framework's implementation
	of Zend_Paginator_Adapter for Doctrine, and so only products on current page are selected. */ ?>
    <?php foreach( $this->products as $product ) { ?>
		<li>
		<?php /* This Zend Framework's view helper builds urls, 
		if needed, Smart Framework injects it and provides correct language id into url according to SF multilinguages system */?>
        <a href="<?= $this->url(array('controller'=>'product-catalogue','action'=>'detail','id'=>$product->id)) ?>">
			<?= $product->translate("name") ?>
		</a>
		
		<?= $this->translate('Price') ?>: <?php /* <- Again translation of static text. */ ?>
		<?php /* Zend_Currency is used here to provide correct numeric format. */ ?>
		<?= $currency->toCurrency($product->price) ?>
		</li>
    <?php } ?>
	
	<?php /* Pagination of products is rendered here. Again thanks to SF's implementation of Zend_Paginator_Adpater. */ ?>
    <center><?= $this->paginationControl($this->products, 'Sliding', 'paginatorControl.phtml') ?></center>
</ul>